refactor: scope the access-token required-flag skip per command - #748
Open
ffantl-ld wants to merge 1 commit into
Open
refactor: scope the access-token required-flag skip per command#748ffantl-ld wants to merge 1 commit into
ffantl-ld wants to merge 1 commit into
Conversation
This was referenced Jul 22, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ffantl-ld
force-pushed
the
ffantl/prerun-flag-skip
branch
from
July 23, 2026 15:15
3d1d7ad to
fcf935d
Compare
ffantl-ld
marked this pull request as ready for review
July 27, 2026 17:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the solution you've provided
Commands that don't need an API token (
completion,config,help,login,signup,whoami) previously skipped the required--access-tokencheck by settingDisableFlagParsing = true. That also suppressed validation of the subcommand's own required flags.This clears the
--access-tokenrequired annotation on the specific flag instead, so those commands still parse and validate their own flags.Related issues
Groundwork for the guided
setupcommand (which also needs to run without a token). Split out so it can land and release on its own merit.Additional context
Behavior-only change to
cmd/root.go; no new packages.Note
Low Risk
Localized CLI startup behavior in root PersistentPreRun; no API, auth, or data-path changes beyond fixing flag validation for exempt commands.
Overview
Auth-exempt commands (
completion,config,help,login,signup,whoamiand their subcommands) no longer setDisableFlagParsing, which was skipping validation for all flags on those commands.Instead,
PersistentPreRuncallsclearAccessTokenRequirement, which walks the command’s parent chain and removes Cobra’s required annotation on the persistent--access-tokenflag when the command tree is under an exempt name. Global flag parsing and subcommand-specific required flags still run as usual.Reviewed by Cursor Bugbot for commit fcf935d. Bugbot is set up for automated code reviews on this repo. Configure here.